package day07test;

import java.util.Scanner;

public class Test4 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入机票价格");
        int price = sc.nextInt();
        System.out.println("请输入机票月份");
        int month = sc.nextInt();
        System.out.println("请选择舱位：1，头等舱，2.商务舱，3.经济舱");
        int choose = sc.nextInt();
        int changePrice = price(price,month,choose);
        if (changePrice>0){
            System.out.println("机票价格为" + changePrice);
        }

    }

    public static int price(int price, int month, int choose) {
        int changePrice = 0;
        if (5 <= month && 10 > month) {
            switch (choose) {
                case 1 -> changePrice = (int) (price * 0.9);
                case 2 -> changePrice = (int) (price * 0.85);
                case 3 -> changePrice = (int) (price * 0.8);
                default -> System.out.println("没有这个舱位");
            }
        } else if (month <= 12 && month < 5) {
            switch (choose) {
                case 1 -> changePrice = (int) (price * 0.7);
                case 2 -> changePrice = (int) (price * 0.65);
                case 3 -> changePrice = (int) (price * 0.6);
                default -> System.out.println("没有这个舱位");
                 }
        }else {
            System.out.println("没有这个月份");
              }
        return changePrice;

         }
}

